package common.container;

import java.io.IOException;

/**
 * @author gitama
 * @version 1.0
 * @date 2022/12/05
 */
public abstract class ServerContainer implements SwitchContainer {


    private final String host;

    private final Integer port;

    public ServerContainer(String host, Integer port) {
        this.host = host;
        this.port = port;
    }

    @Override
    public void start() {
        try {
            this.startServer(this.getHost(), this.getPort());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public abstract void startServer(String host, Integer port) throws IOException;

    public String getHost() {
        return host;
    }

    public Integer getPort() {
        return port;
    }

}
